﻿<%@ Page Language="C#" MasterPageFile="~/MasterPages/AdminMasterPage.master" CodeBehind="List.aspx.cs"
    Inherits="RMS.Admin.List" %>

<%@ Register Src="~/Admin/DynamicData/Content/GridViewPager.ascx" TagName="GridViewPager"
    TagPrefix="asp" %>
<asp:Content ID="Content1" ContentPlaceHolderID="PagContent" runat="Server">
    <asp:DynamicDataManager ID="DynamicDataManager1" runat="server" AutoLoadForeignKeys="true">
        <DataControls>
            <asp:DataControlReference ControlID="GridView1" />
        </DataControls>
    </asp:DynamicDataManager>
    <table class="Details" cellpadding="0" cellspacing="0">
        <tr>
            <td class="header" colspan="2">
                <div>
                    <%= table.DisplayName%></div>
            </td>
        </tr>
        <asp:UpdatePanel ID="UpdatePanel1" runat="server">
            <ContentTemplate>
                <asp:DynamicValidator runat="server" ID="GridViewValidator" ControlToValidate="GridView1"
                    Display="None" />
                <asp:QueryableFilterRepeater runat="server" ID="FilterRepeater">
                    <ItemTemplate>
                        <tr>
                            <td class="label">
                                <asp:Label ID="Label1" runat="server" Text='<%# Eval("DisplayName") %>' OnPreRender="Label_PreRender" />
                            </td>
                            <td>
                                <asp:DynamicFilter runat="server" ID="DynamicFilter" OnFilterChanged="DynamicFilter_FilterChanged" />
                            </td>
                        </tr>
                    </ItemTemplate>
                </asp:QueryableFilterRepeater>
                <tr>
                    <td colspan="2">
                        <asp:GridView ID="GridView1" runat="server" DataSourceID="GridDataSource" EnablePersistedSelection="true"
                            AllowPaging="True" AllowSorting="True">
                            <Columns>
                                <asp:TemplateField>
                                    <ItemTemplate>
                                        <asp:DynamicHyperLink runat="server" Action="Edit" Text="Edit" />&nbsp;<asp:LinkButton
                                            runat="server" CommandName="Delete" Text="Delete" OnClientClick='return confirm("Are you sure you want to delete this item?");' />&nbsp;<asp:DynamicHyperLink
                                                runat="server" Text="Details" />
                                    </ItemTemplate>
                                </asp:TemplateField>
                            </Columns>
                            <PagerTemplate>
                                <asp:GridViewPager runat="server" />
                            </PagerTemplate>
                        </asp:GridView>
                    </td>
                </tr>
                <asp:LinqDataSource ID="GridDataSource" runat="server" EnableDelete="true" />
                <asp:QueryExtender TargetControlID="GridDataSource" ID="GridQueryExtender" runat="server">
                    <asp:DynamicFilterExpression ControlID="FilterRepeater" />
                </asp:QueryExtender>
                <tr>
                    <td colspan="2">
                        <br />
                        &nbsp;
                        <asp:DynamicHyperLink ID="InsertHyperLink" Font-Size="15px" runat="server" Action="Insert"><img runat="server" border="0" src="~/Admin/DynamicData/Content/Images/plus.gif" alt="Insert new item" /> &nbsp;Insert new item</asp:DynamicHyperLink>
                        <br />
                    </td>
                </tr>
                <tr>
                    <td class="footer" colspan="2">
                        <asp:ValidationSummary ID="ValidationSummary1" runat="server" EnableClientScript="true" />
                    </td>
                </tr>
            </ContentTemplate>
        </asp:UpdatePanel>
    </table>
</asp:Content>
